# http://docs.python.org/3.2/tutorial/errors.html
# http://docs.python.org/3.2/library/exceptions.html#bltin-exceptions

"""
invalid syntax 
name '….' is not defined
unindent does not match any 
outer indentation level 
expected an indented block
can't assign to operator
can't assign to literal
"""

"""
a = 1
while b < 20
        Print(b)
        tmp = b
    if a > b:
            print("a daugiau
            elif b > a :
                 prnt("b daugiau")
            else:
    print(lygu)
    b = b + a
    a + b = tmp
"""

#~ def SyntaxNoColumn():
    #~ a = 0
    #~ while a < 5
        #~ print (a)


def NameUndefined1(): # NameError: global name '....' is not defined
    while a < 5:
        print (a)

#~ NameUndefined1()

#~ def NameWhileMisspelled1():  # SyntaxError: invalid syntax  
    #~ b = 1
    #~ wihle b < 5:
        #~ print (b)
#~ 
#~ NameWhileMisspelled1()

def NamePrintMisspelled1():  # NameError: global name '....' is not defined
    b = 1
    while b < 5:
        Print (b)

#~ NamePrintMisspelled1()

def NamePrintMisspelled2(): # NameError: global name '....' is not defined
    for a in range(5):
        prnt(a)

#~ NamePrintMisspelled2()

def input_int(txt):  pass

#~ def Unindent(): # IndentationError: unindent does not match any outer indentation level
    #~ a = input_int("Jūsų vidurkis:")
    #~ if a > 8:
        #~ print( "neblogai" )
      #~ print("bet reikia stengtis")  
        
#~ def IndentedExpected(): # IndentationError: expected an indented block
    #~ a = input_int("Jūsų vidurkis:")
    #~ if a > 8:
        #~ print( "neblogai" )
        #~ if a > 9.5:
            #~ print("ir netgi puikiai!")
        #~ else:
    #~ print("šiaip sau..")

#~ IndentedExpected()
#~ 
#~ def AssignmentToOperator(): # SyntaxError: can't assign to operator
    #~ a = 5
    #~ a + 3 = a

#~ AssignmentToOperator()

#~ def AssignmentToLiteral(): # SyntaxError: can't assign to literal
    #~ 3 = b
    #~ b = b+1
#~ 
#~ AssignmentToLiteral()

#~ def SyntaxPrintMissingSeparator():  # SyntaxError: invalid syntax
    #~ for a in range(5):
        #~ print("a yra" a)

#~ PrintMissingSeparator() 


def ArgumentsMissing1(): # TypeError: count() takes exactly 1 argument (0 given)
    def count( n ):
        while n > 0:
            print(n)
            n = n-1
    n = 2
    count()

#~ ArgumentsMissing1() 


def ArgumentsTooMuch(): # TypeError: pasisveikink() takes no arguments (1 given)
    def pasisveikink():
        print("Labas")

    pasisveikink("Pasauli")

#~ ArgumentsTooMuch() 


def ZeroDivisionError(): # ZeroDivisionError: division by zero
    for a in range(5):
        print( 10 / a )

#~ ZeroDivisionError()

def TypeIntPlusStr(): # TypeError: unsupported operand type(s) for -: 'int' and 'str'
    info = "Aš turiu 20 Lt".split() # ['Aš', 'turiu', '20', 'Lt']
    reikia = 50
    truskta = reikia - info[2]

#~ TypeIntPlusStr()

def Type_CantConvertStrToInt():  # ValueError: invalid literal for int() with base 10: '....'
    info = "Aš turiu 20 Lt".split() # ['Aš', 'turiu', '20', 'Lt']
    turiu = int( info[3] )
    reikia = 50
    truskta = reikia - turiu
       
#~ Type_CantConvertStrToInt()

def IO():  # IOError: [Errno 2] No such file or directory: '.........'
    open("failas.txt", 'r') 
